home *** CD-ROM | disk | FTP | other *** search
- /*
- File: AboutBox.c
-
- Contains: About Box support for SimpleText
-
- Version: GX 1.2 or later
-
- Written by: Tom Dowdy
- DAL = Dave Lyons
-
- Copyright: © 1993-1997 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: Tom Dowdy
-
- Other Contact: Jim Negrette
-
- Technology: Macintosh Graphics Group
-
- Writers:
-
- (dmp) Dave Polaschek
- (TD) Tom Dowdy
-
- Change History (most recent first):
-
- <2> 7/29/97 ted Removed all of the old and boring "refs"
- <3> 9/9/96 dmp staticfy local functions to eliminate warnings in MWC.
- <2> 10/2/95 TD adding support for SC compiler
- <1> 8/21/95 TD First checked in.
- <2> 9/8/94 DAL No longer shows the "read only document" balloon help or
- keypress alert for the About box (no Radar bug? thought it was
- in there). Just added do-nothing routines AboutGetBalloon and
- AboutKeyEvent.
-
- */
-
- #include "MacIncludes.h"
-
- #include "AboutBox.h"
-
-
- // --------------------------------------------------------------------------------------------------------------
- // INTERNAL ROUTINES
- // --------------------------------------------------------------------------------------------------------------
- static void DrawCenteredStringAt(Str255 theString, short yLocation)
- {
- Rect portRect;
- CGrafPtr thePort = GetQDGlobalsThePort();
-
- GetPortBounds(thePort, &portRect);
-
- MoveTo(portRect.left + ((portRect.right-portRect.left) >> 1) -
- (StringWidth(theString) >> 1), yLocation);
- DrawString(theString);
-
- } // DrawCenteredStringAt
-
- // --------------------------------------------------------------------------------------------------------------
- // OOP INTERFACE ROUTINES
- // --------------------------------------------------------------------------------------------------------------
-
- static OSErr AboutUpdateWindow(WindowPtr pWindow, WindowDataPtr pData)
- {
- #pragma unused (pData)
-
- Str255 theString;
- Rect bounds;
-
- // type style for application name
- TextFont(systemFont);
- TextSize(12);
-
- // name of application
- GetIndString(theString, kAboutStrings, 1);
- DrawCenteredStringAt(theString, 32);
-
- // type style for all others
- TextFont(applFont);
- TextSize(9);
-
- // author names
- GetIndString(theString, kAboutStrings, 2);
- DrawCenteredStringAt(theString, 50);
- GetIndString(theString, kAboutStrings, 3);
- DrawCenteredStringAt(theString, 65);
- GetIndString(theString, kAboutStrings, 4);
- DrawCenteredStringAt(theString, 80);
-
- // copyright, on the left
- GetIndString(theString, kAboutStrings, 5);
- MoveTo(10, 105);
- DrawString(theString);
-
- // version, on the right
- GetIndString(theString, kAboutStrings, 6);
- MoveTo((GetWindowPortBounds(pWindow, &bounds)->right - 10) - StringWidth(theString), 105);
- DrawString(theString);
-
- return noErr;
-
- } // AboutUpdateWindow
-
- // --------------------------------------------------------------------------------------------------------------
-
- static OSErr AboutGetBalloon(WindowPtr pWindow, WindowDataPtr pData,
- Point *localMouse, short * returnedBalloonIndex, Rect *returnedRectangle)
- {
- #pragma unused (pWindow, pData, localMouse, returnedRectangle)
-
- *returnedBalloonIndex = iNoBalloon;
-
- return noErr;
-
- } // AboutGetBalloon
-
- // --------------------------------------------------------------------------------------------------------------
-
- static OSErr AboutKeyEvent(WindowPtr pWindow, WindowDataPtr pData, EventRecord *pEvent, Boolean isMotionKey)
- {
- #pragma unused(pWindow, pData, pEvent, isMotionKey)
-
- return noErr;
-
- } // AboutKeyEvent
-
- // --------------------------------------------------------------------------------------------------------------
-
- static OSErr AboutMakeWindow(WindowPtr pWindow, WindowDataPtr pData)
- {
- #pragma unused (pWindow)
-
- pData->pUpdateWindow = (UpdateWindowProc) AboutUpdateWindow;
- pData->pGetBalloon = (GetBalloonProc) AboutGetBalloon;
- pData->pKeyEvent = (KeyEventProc) AboutKeyEvent;
-
- return noErr;
-
- } // AboutMakeWindow
-
- // --------------------------------------------------------------------------------------------------------------
-
- OSErr AboutPreflightWindow(PreflightPtr pPreflightData)
- {
- pPreflightData->resourceID = kAboutWindowID;
- pPreflightData->continueWithOpen = true;
- pPreflightData->makeProcPtr = (MakeWindowProc) AboutMakeWindow;
-
- return noErr;
-
- } // AboutPreflightWindow
-
- // --------------------------------------------------------------------------------------------------------------
-
- void AboutGetFileTypes(OSType * pFileTypes, OSType * pDocumentTypes, short * numTypes)
- {
- #pragma unused (pFileTypes, pDocumentTypes, numTypes)
-
- } // AboutGetFileTypes
-